import request from "../utils/request.js";

// 商品分类
const categorylist = '/api/goods/categories';
// 指定商品分类商品列表
const categoryId = '/api/goods/';
//商品列表
const shopList = '/api/goods/list'
// 秒杀商品详情
const seckillUrl = '/api/seckill/goods/details/'
// 秒杀商品提交
const seckillSubmit = '/api/seckill/order/save';

// 商品详情
const goodsDetail = '/api/goods/';
// 添加到购物车
const addCar = '/api/members/carts/add';
// 商品可领卡券
const coupons = '/api/goods/';
// 领取卡券
const couponsReceive = '/api/members/coupons/receive';
// 店铺信息
const storeDetail = '/api/store/details/';
// 拼团商品列表
const groupbuylist = '/api/groupbuy/list';
// 拼团商品详情
const groupDetail = '/api/groupbuy/details/';
// 拼团发起人列表
const groupbuyCreate = '/api/groupbuy/order/creator/';

export function getAddTeams(data) {
	return request({
		url: '/api/members/general/' + data,
		method: 'get',
		// data
	})
}

// 商品分类
export function getCategorylist(data) {
	return request({
		url: categorylist,
		method: 'get',
		data
	})
}
export function getSecondList(data) {
	return request({
		url: shopList,
		method: 'get',
		data
	})
}
// 指定商品分类商品列表
export function categoryIds(data, data2) {
	return request({
		url: categoryId + data + '/list',
		method: 'get',
		data: data2
	})
}
// 秒杀商品详情
export function getSeckillId(data) {
	return request({
		url: seckillUrl + data,
		method: 'get',
	})
}
// 秒杀商品提交
export function submitSeckillId(data) {
	return request({
		url: seckillSubmit,
		method: 'post',
		data
	})
}

// 商品详情
export function goodsDetails(data) {
	return request({
		url: goodsDetail + data + '/details',
		method: 'get',
		// data
	})
}

// 加入购物车 
export function shopGoodsCartAdd(data) {
	return request({
		url: addCar,
		method: 'post',
		data
	})
}

// // 商品可领卡券
export function shopCoupons(data) {
	return request({
		url: coupons + data + '/coupons',
		method: 'get',
		// data
	})
}
// 领取卡券
export function addCouponsReceive(data) {
	return request({
		url: couponsReceive,
		method: 'post',
		data
	})
}
// 店铺信息
export function getStoreDetail(data) {
	return request({
		url: storeDetail + data,
		method: 'get',
	})
}

// 拼团商品列表
export function getGroupbuylist(data) {
	return request({
		url: groupbuylist,
		method: 'get',
		data
	})
}
// 拼团商品详情
export function getGroupDetail(data) {
	return request({
		url: groupDetail + data,
		method: 'get',
		// data
	})
}
// 拼团发起人列表
export function getGroupbuyCreate(data) {
	return request({
		url: groupbuyCreate + data,
		method: 'get',
		// data
	})
}

